package template

import (
	"gopkg.in/yaml.v3"
)

func AgentConfigTemplate(role string, platfrom string) interface{} {
	var data interface{}

	var config string
	switch {
	case platfrom == `kubernetes` && role != `normal`:
		config = Platform_k8s_Role_Normal
	case platfrom == `kubernetes` && role == `other`:
		config = Platform_k8s_Role_Other
	case platfrom == `gluenets` && role == `normal`:
		config = Platform_Docker_Role_Normal
	}

	err := yaml.Unmarshal([]byte(config), &data)
	if err != nil {
		panic(err)
	}
	return data
}

var Platform_k8s_Role_Normal = `
heartbeat_interval: 3
rpc_services:
  - "k8s"
  - "helm"
monitor_components:
  - "prometheus"  
  - "vector"
  - "jaeger"
`

var Platform_k8s_Role_Other = `
heartbeat_interval: 3
monitor_components:
  - "prometheus"  
  - "vector"
  - "jaeger"
  - "apps"
`

var Platform_Docker_Role_Normal = `
heartbeat_interval: 3
rpc_services:
  - "container"
  - "proxy"
monitor_components:
  - "prometheus"  
  - "vector"
  - "jaeger"
http_services:
  - "prometheus"
`
